<%--
  Created by IntelliJ IDEA.
  User: sicilin
  Date: 2017/9/7
  Time: 9:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="commons-bootstrap.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title>登陆页面</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type="text/css">
        .loginPanel{
            width:350px;
            min-height:350px;
            padding:30px 45px;
            float:right;
            position:relative;
            top:20px;
        }
        .loginInput{
            margin:15px auto;
            width:260px;
        }
        .loginBtn{
            width:260px;
        }
    </style>
    <script type="text/javascript" src="<%=basePath%>common/script/customize/customize.js"></script>
    <script>
        function loginDo(){
            var param = FormUtils.getFormData($('#loginForm'));
            AjaxUtils.tmsAjax({
                url:basePath+'login.json'
                ,data:JSON.stringify(param)
                ,type:'post'
                ,success:function(url){
                    $('#loginForm').css('display',"none");
                    $('#messageDiv').css("display","block");
                    $('#messageAlert').removeClass();
                    $('#messageAlert').addClass("alert alert-success");
                    $('#messageAlert').text("登陆成功！");
                    window.location.href = basePath + url;
                }
                ,error:function (code,errorMsg) {
                    $('#messageAlert').text(errorMsg);
                    $('#messageDiv').css("display","block");
                    $('#messageAlert').removeClass();
                    $('#messageAlert').addClass("alert alert-danger");
                    $('#messageAlert').text("登陆失败！"+errorMsg);
                }
            });
        }
    </script>
</head>
<body>
    <div class="container-fluid" style="padding:30px;">
        <!-- 登陆框 -->
        <div class="panel panel-default loginPanel">
            <!-- 表单start -->
            <img class="img-responsive center-block" src = "<%=basePath%>common/img/logo.png"/>
            <form id = "loginForm">
                <div class="input-group loginInput">
                    <span class="input-group-addon" id="icon-user"><i class="iconfont icon-user"></i></span>
                    <input name ="account" type="text" class="form-control" placeholder="用户名" aria-describedby="icon-user" />
                </div>
                <div class="input-group loginInput">
                    <span id="icon-password" class="input-group-addon"><i class="iconfont icon-key"></i></span>
                    <input name ="password" type="password" class="form-control" placeholder="密码" aria-describedby="icon-password" aria-describedby="icon-password" />
                </div>
                <button type="button" class="btn btn-info center-block loginBtn" onclick="loginDo()" >登陆</button>
            </form><!-- 表单end -->

            <div id="messageDiv" style="display: none;">
                <div id = "messageAlert"></div>
            </div>
        </div>
    </div>

</body>
</html>
